import wx


class MyFrame(wx.Frame):

    def __init__(self, parent, id):
        super().__init__(parent, id, 'Frame With Button', size=(300, 100))

        panel = wx.Panel(self, -1)

        okButton = wx.Button(panel, -1, 'Ok', pos=(100, 15), size=(40, 40))
        closeButton = wx.Button(panel, -1, 'Close', pos=(150, 15), size=(40, 40))
        self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
        self.Bind(wx.EVT_BUTTON, self.OnCloseMe, closeButton)
        self.Bind(wx.EVT_BUTTON, self.OnOkMe, okButton)

    def OnCloseMe(self, event):
        print("onCloseMe")
        #self.Close()

    def OnOkMe(self, event):
        print("OnOkMe")
        #self.Close()

    def OnCloseWindow(self, event):
        print("onCloseWindow")
        #self.Destroy()


app = wx.App()

frame = MyFrame(None, -1)

frame.Show(True)

app.MainLoop()
